package cn.iocoder.yudao.module.ym.dal.mysql.sitedata;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ym.dal.dataobject.area.AreaDO;
import cn.iocoder.yudao.module.ym.dal.dataobject.site.SiteDO;
import cn.iocoder.yudao.module.ym.dal.dataobject.sitedata.SiteDataDO;
import cn.iocoder.yudao.module.ym.dal.mysql.area.AreaMapper;
import cn.iocoder.yudao.module.ym.dal.mysql.site.SiteMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ym.controller.admin.sitedata.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 电站数据 Mapper
 *
 * @author 韩艳阳
 */
@Mapper
public interface SiteDataMapper extends BaseMapperX<SiteDataDO> {
    default PageResult<SiteDataDO> selectPage(SiteDataPageReqVO reqVO) {
        LambdaQueryWrapper<SiteDataDO> siteDataDOLambdaQueryWrapperX = new LambdaQueryWrapperX<SiteDataDO>()
                .eqIfPresent(SiteDataDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SiteDataDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(SiteDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SiteDataDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(SiteDataDO::getYear, reqVO.getYear())
                .eqIfPresent(SiteDataDO::getMonth, reqVO.getMonth())
                .eqIfPresent(SiteDataDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SiteDataDO::getElectricQuantity, reqVO.getElectricQuantity())
                .eqIfPresent(SiteDataDO::getFastChargeQuantity, reqVO.getFastChargeQuantity())
                .eqIfPresent(SiteDataDO::getSlowChargeQuantity, reqVO.getSlowChargeQuantity())
                .eqIfPresent(SiteDataDO::getRatedPower, reqVO.getRatedPower())
                .eqIfPresent(SiteDataDO::getPowerUtilization, reqVO.getPowerUtilization())
                .eqIfPresent(SiteDataDO::getCommPower, reqVO.getCommPower())
                .eqIfPresent(SiteDataDO::getPfFee, reqVO.getPfFee())
                .eqIfPresent(SiteDataDO::getElecCost, reqVO.getElecCost())
                .eqIfPresent(SiteDataDO::getPowerLoss, reqVO.getPowerLoss())
                .eqIfPresent(SiteDataDO::getLossRate, reqVO.getLossRate())
                .eqIfPresent(SiteDataDO::getDeprec, reqVO.getDeprec())
                .eqIfPresent(SiteDataDO::getOpCostShare, reqVO.getOpCostShare())
                .eqIfPresent(SiteDataDO::getOpCostRent, reqVO.getOpCostRent())
                .eqIfPresent(SiteDataDO::getOpCostOther, reqVO.getOpCostOther())
                .eqIfPresent(SiteDataDO::getOpCostLabor, reqVO.getOpCostLabor())
                .eqIfPresent(SiteDataDO::getOpCostFacility, reqVO.getOpCostFacility())
                .eqIfPresent(SiteDataDO::getMaintCost, reqVO.getMaintCost())
                .eqIfPresent(SiteDataDO::getElecRev, reqVO.getElecRev())
                .eqIfPresent(SiteDataDO::getOpCostAll, reqVO.getOpCostAll())
                .eqIfPresent(SiteDataDO::getEdDiscount, reqVO.getEdDiscount())
                .eqIfPresent(SiteDataDO::getSelfOpAll, reqVO.getSelfOpAll())
                .eqIfPresent(SiteDataDO::getServFeeRev, reqVO.getServFeeRev())
                .eqIfPresent(SiteDataDO::getValueAddServ, reqVO.getValueAddServ())
                .eqIfPresent(SiteDataDO::getCompServRev, reqVO.getCompServRev())
                .eqIfPresent(SiteDataDO::getSelfOpGp, reqVO.getSelfOpGp())
                .eqIfPresent(SiteDataDO::getOtherRev, reqVO.getOtherRev())
                .eqIfPresent(SiteDataDO::getOtherCost, reqVO.getOtherCost())
                .orderByDesc(SiteDataDO::getId);


        return selectPage(reqVO,siteDataDOLambdaQueryWrapperX);

    }

    default List<SiteDataDO> selectList(SiteDataPageReqVO reqVO) {
        LambdaQueryWrapper<SiteDataDO> siteDataDOLambdaQueryWrapperX = new LambdaQueryWrapperX<SiteDataDO>()
                .eqIfPresent(SiteDataDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SiteDataDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(SiteDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SiteDataDO::getSiteId, reqVO.getSiteId())
                .eqIfPresent(SiteDataDO::getYear, reqVO.getYear())
                .eqIfPresent(SiteDataDO::getMonth, reqVO.getMonth())
                .eqIfPresent(SiteDataDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SiteDataDO::getElectricQuantity, reqVO.getElectricQuantity())
                .eqIfPresent(SiteDataDO::getFastChargeQuantity, reqVO.getFastChargeQuantity())
                .eqIfPresent(SiteDataDO::getSlowChargeQuantity, reqVO.getSlowChargeQuantity())
                .eqIfPresent(SiteDataDO::getRatedPower, reqVO.getRatedPower())
                .eqIfPresent(SiteDataDO::getPowerUtilization, reqVO.getPowerUtilization())
                .eqIfPresent(SiteDataDO::getCommPower, reqVO.getCommPower())
                .eqIfPresent(SiteDataDO::getPfFee, reqVO.getPfFee())
                .eqIfPresent(SiteDataDO::getElecCost, reqVO.getElecCost())
                .eqIfPresent(SiteDataDO::getPowerLoss, reqVO.getPowerLoss())
                .eqIfPresent(SiteDataDO::getLossRate, reqVO.getLossRate())
                .eqIfPresent(SiteDataDO::getDeprec, reqVO.getDeprec())
                .eqIfPresent(SiteDataDO::getOpCostShare, reqVO.getOpCostShare())
                .eqIfPresent(SiteDataDO::getOpCostRent, reqVO.getOpCostRent())
                .eqIfPresent(SiteDataDO::getOpCostOther, reqVO.getOpCostOther())
                .eqIfPresent(SiteDataDO::getOpCostLabor, reqVO.getOpCostLabor())
                .eqIfPresent(SiteDataDO::getOpCostFacility, reqVO.getOpCostFacility())
                .eqIfPresent(SiteDataDO::getMaintCost, reqVO.getMaintCost())
                .eqIfPresent(SiteDataDO::getElecRev, reqVO.getElecRev())
                .eqIfPresent(SiteDataDO::getOpCostAll, reqVO.getOpCostAll())
                .eqIfPresent(SiteDataDO::getEdDiscount, reqVO.getEdDiscount())
                .eqIfPresent(SiteDataDO::getSelfOpAll, reqVO.getSelfOpAll())
                .eqIfPresent(SiteDataDO::getServFeeRev, reqVO.getServFeeRev())
                .eqIfPresent(SiteDataDO::getValueAddServ, reqVO.getValueAddServ())
                .eqIfPresent(SiteDataDO::getCompServRev, reqVO.getCompServRev())
                .eqIfPresent(SiteDataDO::getSelfOpGp, reqVO.getSelfOpGp())
                .eqIfPresent(SiteDataDO::getOtherRev, reqVO.getOtherRev())
                .eqIfPresent(SiteDataDO::getOtherCost, reqVO.getOtherCost())
                .orderByDesc(SiteDataDO::getId);



        return selectList(siteDataDOLambdaQueryWrapperX);
    }

    default LambdaQueryWrapper<SiteDataDO> sumList(SiteDataPageReqVO reqVO) {
        LambdaQueryWrapper<SiteDataDO> siteDataDOLambdaQueryWrapperX = new LambdaQueryWrapperX<SiteDataDO>()
                .eqIfPresent(SiteDataDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SiteDataDO::getDeptId, reqVO.getDeptId())
                .betweenIfPresent(SiteDataDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SiteDataDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SiteDataDO::getElectricQuantity, reqVO.getElectricQuantity())
                .eqIfPresent(SiteDataDO::getFastChargeQuantity, reqVO.getFastChargeQuantity())
                .eqIfPresent(SiteDataDO::getSlowChargeQuantity, reqVO.getSlowChargeQuantity())
                .eqIfPresent(SiteDataDO::getRatedPower, reqVO.getRatedPower())
                .eqIfPresent(SiteDataDO::getPowerUtilization, reqVO.getPowerUtilization())
                .eqIfPresent(SiteDataDO::getCommPower, reqVO.getCommPower())
                .eqIfPresent(SiteDataDO::getPfFee, reqVO.getPfFee())
                .eqIfPresent(SiteDataDO::getElecCost, reqVO.getElecCost())
                .eqIfPresent(SiteDataDO::getPowerLoss, reqVO.getPowerLoss())
                .eqIfPresent(SiteDataDO::getLossRate, reqVO.getLossRate())
                .eqIfPresent(SiteDataDO::getDeprec, reqVO.getDeprec())
                .eqIfPresent(SiteDataDO::getOpCostShare, reqVO.getOpCostShare())
                .eqIfPresent(SiteDataDO::getOpCostRent, reqVO.getOpCostRent())
                .eqIfPresent(SiteDataDO::getOpCostOther, reqVO.getOpCostOther())
                .eqIfPresent(SiteDataDO::getOpCostLabor, reqVO.getOpCostLabor())
                .eqIfPresent(SiteDataDO::getOpCostFacility, reqVO.getOpCostFacility())
                .eqIfPresent(SiteDataDO::getMaintCost, reqVO.getMaintCost())
                .eqIfPresent(SiteDataDO::getElecRev, reqVO.getElecRev())
                .eqIfPresent(SiteDataDO::getOpCostAll, reqVO.getOpCostAll())
                .eqIfPresent(SiteDataDO::getEdDiscount, reqVO.getEdDiscount())
                .eqIfPresent(SiteDataDO::getSelfOpAll, reqVO.getSelfOpAll())
                .eqIfPresent(SiteDataDO::getServFeeRev, reqVO.getServFeeRev())
                .eqIfPresent(SiteDataDO::getValueAddServ, reqVO.getValueAddServ())
                .eqIfPresent(SiteDataDO::getCompServRev, reqVO.getCompServRev())
                .eqIfPresent(SiteDataDO::getSelfOpGp, reqVO.getSelfOpGp())
                .eqIfPresent(SiteDataDO::getOtherRev, reqVO.getOtherRev())
                .eqIfPresent(SiteDataDO::getOtherCost, reqVO.getOtherCost())
                .eqIfPresent(SiteDataDO::getSlowCapacity, reqVO.getSlowCapacity())
                .eqIfPresent(SiteDataDO::getFastCapacity, reqVO.getFastCapacity())
                .orderByDesc(SiteDataDO::getId);


        return siteDataDOLambdaQueryWrapperX;
    }

    List<SiteDataDO> selectByCompositeKeys(@Param("checkKeys") List<Triple<Long, Integer, Integer>> checkKeys);

}
